package com.zhengxing.jienci.handler;

import org.springframework.http.HttpStatus;
import org.springframework.security.oauth2.common.exceptions.UnapprovedClientAuthenticationException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;

import com.zhengxing.jienci.common.support.SimpleResponse;


@ControllerAdvice
public class ExceptionController {
	
	
	@ExceptionHandler(UnapprovedClientAuthenticationException.class)
	@ResponseBody
	@ResponseStatus(HttpStatus.BAD_REQUEST)
	public SimpleResponse unapprovedClientAuthenticationException(UnapprovedClientAuthenticationException exception) {
		return SimpleResponse.fail(exception.getMessage());
	}
}
